package singleton;

/**
 * @author : DuJiabao
 * @Date : 2021/3/1 17:20
 * @Project : design-pattern
 * @File : null.java
 * @Desc :
 */
public class Singleton2 {
  // 静态常量对象
  private final static Singleton2 instance;

  // 静态代码块，实例化对象
  static {
    instance = new Singleton2();
  }

  private Singleton2() {
  }
  // 返回对象
  public static Singleton2 getInstance() {
    return instance;
  }
}
